<?php

namespace Modules\Admin\Entities;

use Houdunwang\Module\Traits\Db;
use Illuminate\Database\Eloquent\Model;

class Module extends Model
{
    protected $fillable = ['title','name','is_default','home_access'];
    public function setDefault(){
        //将当前所有模块的is_default设置为0
		\DB::table ('modules')->update (['is_default' => 0]);
		//将当前模型的数据is_default设置为1
		$this->is_default = 1;
		$this->save ();
	}
}
